<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Bundler::URI::MailTo - bundler: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Generic.html">Bundler::URI::Generic</a>
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="RFC2396_REGEXP.html">Bundler::URI::RFC2396_REGEXP</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li class="calls-super" ><a href="#method-c-build">::build</a>
    <li class="calls-super" ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-check_headers">#check_headers</a>
    <li ><a href="#method-i-check_to">#check_to</a>
    <li ><a href="#method-i-headers-3D">#headers=</a>
    <li ><a href="#method-i-set_headers">#set_headers</a>
    <li ><a href="#method-i-set_to">#set_to</a>
    <li ><a href="#method-i-to-3D">#to=</a>
    <li ><a href="#method-i-to_mailtext">#to_mailtext</a>
    <li ><a href="#method-i-to_rfc822text">#to_rfc822text</a>
    <li ><a href="#method-i-to_s">#to_s</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Bundler::URI::MailTo">
    <h1 id="class-Bundler::URI::MailTo" class="class">
      class Bundler::URI::MailTo
    </h1>

    <section class="description">
    
<p>RFC6068, the mailto URL scheme.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="COMPONENT">COMPONENT
          <dd><p>An Array of the available components for <a href="MailTo.html"><code>Bundler::URI::MailTo</code></a>.</p>
          <dt id="DEFAULT_PORT">DEFAULT_PORT
          <dd><p>A Default port of nil for <a href="MailTo.html"><code>Bundler::URI::MailTo</code></a>.</p>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-headers" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">headers</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>E-mail headers set by the URL, as an Array of Arrays.</p>
              </div>
            </div>
          <div id="attribute-i-to" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">to</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The primary e-mail address of the URL, as a String.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-build" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">build</span><span
                                class="method-args">(args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <h2 id="method-c-build-label-Description">Description<span><a href="#method-c-build-label-Description">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>Creates a new <a href="MailTo.html"><code>Bundler::URI::MailTo</code></a> object from components, with syntax checking.</p>

<p>Components can be provided as an Array or Hash. If an Array is used, the components must be supplied as <code>[to, headers]</code>.</p>

<p>If a Hash is used, the keys are the component names preceded by colons.</p>

<p>The headers can be supplied as a pre-encoded string, such as <code>&quot;subject=subscribe&amp;cc=address&quot;</code>, or as an Array of Arrays like <code>[[&#39;subject&#39;, &#39;subscribe&#39;], [&#39;cc&#39;, &#39;address&#39;]]</code>.</p>

<p>Examples:</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;bundler/vendor/uri/lib/uri&#39;</span>

<span class="ruby-identifier">m1</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">MailTo</span>.<span class="ruby-identifier">build</span>([<span class="ruby-string">&#39;joe@example.com&#39;</span>, <span class="ruby-string">&#39;subject=Ruby&#39;</span>])
<span class="ruby-identifier">m1</span>.<span class="ruby-identifier">to_s</span>  <span class="ruby-comment"># =&gt; &quot;mailto:joe@example.com?subject=Ruby&quot;</span>

<span class="ruby-identifier">m2</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">MailTo</span>.<span class="ruby-identifier">build</span>([<span class="ruby-string">&#39;john@example.com&#39;</span>, [[<span class="ruby-string">&#39;Subject&#39;</span>, <span class="ruby-string">&#39;Ruby&#39;</span>], [<span class="ruby-string">&#39;Cc&#39;</span>, <span class="ruby-string">&#39;jack@example.com&#39;</span>]]])
<span class="ruby-identifier">m2</span>.<span class="ruby-identifier">to_s</span>  <span class="ruby-comment"># =&gt; &quot;mailto:john@example.com?Subject=Ruby&amp;Cc=jack@example.com&quot;</span>

<span class="ruby-identifier">m3</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">MailTo</span>.<span class="ruby-identifier">build</span>({<span class="ruby-value">:to</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&#39;listman@example.com&#39;</span>, <span class="ruby-value">:headers</span> <span class="ruby-operator">=&gt;</span> [[<span class="ruby-string">&#39;subject&#39;</span>, <span class="ruby-string">&#39;subscribe&#39;</span>]]})
<span class="ruby-identifier">m3</span>.<span class="ruby-identifier">to_s</span>  <span class="ruby-comment"># =&gt; &quot;mailto:listman@example.com?subject=subscribe&quot;</span>
</pre>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="Generic.html#method-c-build"><code>Bundler::URI::Generic::build</code></a>
                              </div>

                              <div class="method-source-code" id="build-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 85</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">build</span>(<span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">Util</span>.<span class="ruby-identifier">make_components_hash</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">args</span>)

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:to</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
    <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:opaque</span>] = <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:to</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;,&#39;</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
    <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:opaque</span>] = <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:to</span>].<span class="ruby-identifier">dup</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:opaque</span>] = <span class="ruby-string">&#39;&#39;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:headers</span>]
    <span class="ruby-identifier">query</span> =
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:headers</span>]
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
        <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:headers</span>].<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
            <span class="ruby-identifier">x</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-string">&#39;=&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">join</span>
          <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_s</span>
          <span class="ruby-keyword">end</span>
        }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;&amp;&#39;</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Hash</span>
        <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:headers</span>].<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">h</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;=&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">v</span>
        }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;&amp;&#39;</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:headers</span>].<span class="ruby-identifier">to_s</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">query</span>.<span class="ruby-identifier">empty?</span>
      <span class="ruby-identifier">tmp</span>[<span class="ruby-value">:opaque</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;?&#39;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">query</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">tmp</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(*arg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <h2 id="method-c-new-label-Description">Description<span><a href="#method-c-new-label-Description">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>Creates a new <a href="MailTo.html"><code>Bundler::URI::MailTo</code></a> object from generic URL components with no syntax checking.</p>

<p>This method is usually called from <a href="../URI.html#method-c-parse"><code>Bundler::URI::parse</code></a>, which checks the validity of each component.</p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="Generic.html#method-c-new"><code>Bundler::URI::Generic::new</code></a>
                              </div>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>)
  <span class="ruby-keyword">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">arg</span>)

  <span class="ruby-ivar">@to</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@headers</span> = []

  <span class="ruby-comment"># The RFC3986 parser does not normally populate opaque</span>
  <span class="ruby-ivar">@opaque</span> = <span class="ruby-node">&quot;?#{@query}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@query</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@opaque</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@opaque</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidComponentError</span>,
      <span class="ruby-string">&quot;missing opaque part for mailto URL&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">to</span>, <span class="ruby-identifier">header</span> = <span class="ruby-ivar">@opaque</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;?&#39;</span>, <span class="ruby-value">2</span>)
  <span class="ruby-comment"># allow semicolon as a addr-spec separator</span>
  <span class="ruby-comment"># http://support.microsoft.com/kb/820868</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-regexp">/\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">to</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidComponentError</span>,
      <span class="ruby-node">&quot;unrecognised opaque part for mailtoURL: #{@opaque}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span>[<span class="ruby-value">10</span>] <span class="ruby-comment"># arg_check</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to</span> = <span class="ruby-identifier">to</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">headers</span> = <span class="ruby-identifier">header</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">set_to</span>(<span class="ruby-identifier">to</span>)
    <span class="ruby-identifier">set_headers</span>(<span class="ruby-identifier">header</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-headers-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">headers=</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Setter for headers <code>v</code>.</p>

                              <div class="method-source-code" id="headers-3D-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 232</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">headers=</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">check_headers</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">set_headers</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">v</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to=</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Setter for to <code>v</code>.</p>

                              <div class="method-source-code" id="to-3D-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 200</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to=</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">check_to</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">set_to</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-identifier">v</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_mailtext" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_mailtext</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the RFC822 e-mail text equivalent of the URL, as a String.</p>

<p>Example:</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;bundler/vendor/uri/lib/uri&#39;</span>

<span class="ruby-identifier">uri</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;mailto:ruby-list@ruby-lang.org?Subject=subscribe&amp;cc=myaddr&quot;</span>)
<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_mailtext</span>
<span class="ruby-comment"># =&gt; &quot;To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n&quot;</span>
</pre>

                              <div class="method-source-code" id="to_mailtext-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 268</span>
    <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_mailtext</span>
      <span class="ruby-identifier">to</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">decode_www_form_component</span>(<span class="ruby-ivar">@to</span>)
      <span class="ruby-identifier">head</span> = <span class="ruby-string">&#39;&#39;</span>
      <span class="ruby-identifier">body</span> = <span class="ruby-string">&#39;&#39;</span>
      <span class="ruby-ivar">@headers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">case</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">0</span>]
        <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;body&#39;</span>
          <span class="ruby-identifier">body</span> = <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">decode_www_form_component</span>(<span class="ruby-identifier">x</span>[<span class="ruby-value">1</span>])
        <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;to&#39;</span>
          <span class="ruby-identifier">to</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;, &#39;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">decode_www_form_component</span>(<span class="ruby-identifier">x</span>[<span class="ruby-value">1</span>])
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">head</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">decode_www_form_component</span>(<span class="ruby-identifier">x</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">capitalize</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;: &#39;</span> <span class="ruby-operator">+</span>
            <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">decode_www_form_component</span>(<span class="ruby-identifier">x</span>[<span class="ruby-value">1</span>])  <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\n&quot;</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-node">&quot;To: #{to}
#{head}
#{body}
&quot;</span>
    <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="MailTo.html#method-i-to_rfc822text">to_rfc822text</a>
                            </div>

                          </div>

                  <div id="method-i-to_rfc822text" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">to_rfc822text</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="MailTo.html#method-i-to_mailtext">to_mailtext</a>
                            </div>
                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_s</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Constructs String from <a href="../URI.html"><code>Bundler::URI</code></a>.</p>

                              <div class="method-source-code" id="to_s-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 239</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
  <span class="ruby-ivar">@scheme</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;:&#39;</span> <span class="ruby-operator">+</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@to</span>
      <span class="ruby-ivar">@to</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-string">&#39;&#39;</span>
    <span class="ruby-keyword">end</span> <span class="ruby-operator">+</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@headers</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
      <span class="ruby-string">&#39;?&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@headers</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;=&#39;</span>)}.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;&amp;&#39;</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-string">&#39;&#39;</span>
    <span class="ruby-keyword">end</span> <span class="ruby-operator">+</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@fragment</span>
      <span class="ruby-string">&#39;#&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fragment</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-string">&#39;&#39;</span>
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="protected-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Protected Instance Methods</h3>
                </header>

                  <div id="method-i-set_headers" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_headers</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Private setter for headers <code>v</code>.</p>

                              <div class="method-source-code" id="set_headers-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 221</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_headers</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-ivar">@headers</span> = []
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">v</span>
    <span class="ruby-identifier">v</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;&amp;&#39;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
      <span class="ruby-ivar">@headers</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/=/</span>, <span class="ruby-value">2</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_to" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_to</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Private setter for to <code>v</code>.</p>

                              <div class="method-source-code" id="set_to-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 194</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_to</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-ivar">@to</span> = <span class="ruby-identifier">v</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-check_headers" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_headers</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Checks the headers <code>v</code> component against either</p>
<ul><li>
<p>HEADER_REGEXP</p>
</li></ul>

                              <div class="method-source-code" id="check_headers-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 208</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_headers</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">HEADER_REGEXP</span> <span class="ruby-operator">!~</span> <span class="ruby-identifier">v</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidComponentError</span>,
      <span class="ruby-node">&quot;bad component(expected opaque component): #{v}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_to" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_to</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Checks the to <code>v</code> component.</p>

                              <div class="method-source-code" id="check_to-source">
            <pre><span class="ruby-comment"># File bundler/vendor/uri/lib/uri/mailto.rb, line 169</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_to</span>(<span class="ruby-identifier">v</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">v</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>

  <span class="ruby-identifier">v</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/[,;]/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">addr</span><span class="ruby-operator">|</span>
    <span class="ruby-comment"># check url safety as path-rootless</span>
    <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\A(?:%\h\h|[!$&amp;-.0-;=@-Z_a-z~])*\z/</span> <span class="ruby-operator">!~</span> <span class="ruby-identifier">addr</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidComponentError</span>,
        <span class="ruby-node">&quot;an address in &#39;to&#39; is invalid as Bundler::URI #{addr.dump}&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-comment"># check addr-spec</span>
    <span class="ruby-comment"># don&#39;t s/\+/ /g</span>
    <span class="ruby-identifier">addr</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/%\h\h/</span>, <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">TBLDECWWWCOMP_</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-constant">EMAIL_REGEXP</span> <span class="ruby-operator">!~</span> <span class="ruby-identifier">addr</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidComponentError</span>,
        <span class="ruby-node">&quot;an address in &#39;to&#39; is invalid as uri-escaped addr-spec #{addr.dump}&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

